<?php
/**
 * ----------------------------------------
 * @link http://www.ruaby.com/
 * @copyright Copyright (c) 2016 RuabySoft
 * @license http://www.ruaby.com/license/
 *
 * @author 18/8/10 下午10:26
 */

namespace Zeke\Contracts\Event;

interface EventEmitterContract
{


    /**
     * 绑定事件
     *
     * @param $event
     * @param callable $listener
     * @return mixed
     *
     * @author <liu.bin@ruaby.com> 2018-08-28 10:24
     */
    public function on($event, callable $listener);


    /**
     * 绑定一次
     *
     * @param $event
     * @param callable $listener
     * @return mixed
     *
     * @author <liu.bin@ruaby.com> 2018-08-28 10:25
     */
    public function once($event, callable $listener);


    /**
     * 移除事件侦听
     *
     * @param $event
     * @param callable $listener
     * @return mixed
     *
     * @author <liu.bin@ruaby.com> 2018-08-28 10:25
     */
    public function removeListener($event, callable $listener);


    /**
     * 移除所有的事件侦听
     *
     * @param null $event
     * @return mixed
     *
     * @author <liu.bin@ruaby.com> 2018-08-28 10:25
     */
    public function removeAllListeners($event = null);


    /**
     *
     *
     * @param $event
     * @return mixed
     *
     * @author <liu.bin@ruaby.com> 2018-08-28 10:26
     */
    public function listeners($event);


    /**
     * 触发事件
     *
     * @param $event
     * @param array $arguments
     * @return mixed
     *
     * @author <liu.bin@ruaby.com> 2018-08-28 10:26
     */
    public function emit($event, array $arguments = []);

}